<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="../../include.inc.jsp"%>
<div class="row">
    <div class="col-lg-12">
        <form id="formDlg" class="form-horizontal" role="form">
            <input type="hidden" id="id" name="id" value="${sellerDiscount.id}" />
            <!-- 数据权限 -->
            <input type="hidden" id="organizationId" name="organization.id" value="${organizationId}" /> 
            <div class="form-group">
                <label class="col-lg-2 control-label">所属商家:</label><span class="text-danger">*</span>
                <div class="col-lg-9">
                    <input type="hidden" class="form-control" id="foodSellerId" name="foodSeller.id" value="${sellerDiscount.foodSeller.id}" />
                    <input type="text" readonly="readonly" class="form-control" id="foodSellerName" name="foodSellerName" value="${sellerDiscount.foodSeller.name}" onclick="selectHospital();"/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-lg-2 control-label">折扣名称:</label><span class="text-danger">*</span>
                <div class="col-lg-9">
                    <input type="text" maxlength="30" class="form-control" id="name" name="name" value="${sellerDiscount.name}" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-lg-2 control-label">折扣编码:</label><span class="text-danger">*</span>
                <div class="col-lg-9">
                    <input type="text" maxlength="10" class="form-control" id="code" name="code" value="${sellerDiscount.code}" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-lg-2 control-label">折扣:</label><span class="text-danger">*</span>
                <div class="col-lg-9">
                    <input type="number" class="form-control" id="discount" name="discount" value="${sellerDiscount.discount}" />
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
function selectHospital(){
	var ajaxSelectUrl = contextPath + '/manage/ordering/foodSeller/select';
	showSelectDlg("选择医院",ajaxSelectUrl,"table-data1","foodSellerId","foodSellerName");
}
jQuery(function($) {
    $('#formDlg').validate({
        errorElement : 'span',
        errorClass : 'help-block',
        focusCleanup : false,
        focusInvalid : false,
        onsubmit : false,
        rules : {
            "name":{required:true},
            "code":{required:true},
            "discount":{required:true},
            "foodSellerName":{required:true}
        },
        messages : {
            "name" : '请输入折扣名称',
            "code" : '请输入折扣编码',
            "discount" : '请输入折扣率',
            "foodSellerName" : '请选择所属商家',
        },
        highlight : function(e) {
            $(e).closest('.form-group').removeClass('has-info').addClass('has-error');
        },
        success : function(e) {
            $(e).closest('.form-group').removeClass('has-error').addClass('has-success');
            $(e).remove();
        },
    });
});
</script>